package org.tnc.hr.dao.hibernate;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.tnc.dao.hibernate.GenericDaoHibernate;
import org.tnc.hr.dao.WorkDaysDao;
import org.tnc.hr.model.WorkDays;

public class WorkDaysDaoHibernate extends GenericDaoHibernate<WorkDays, Integer> implements WorkDaysDao {

    public WorkDaysDaoHibernate() {
        super(WorkDays.class);
    }
    
    public List<WorkDays> getWorkDaysByMonth(Date startDate, Date endDate){
        DetachedCriteria c = DetachedCriteria.forClass(WorkDays.class);
        List<WorkDays> list = new ArrayList<WorkDays>();
        if (startDate != null && endDate != null) {
            c.add(Restrictions.ge("workDay", startDate));
            c.add(Restrictions.le("workDay", endDate));
        }
        list = this.getHibernateTemplate().findByCriteria(c);
        return list;
    }
    
    
//    public void saveWorkDays(WorkDays wd) {
//        this.getHibernateTemplate().save(wd);
//    }
    
    
    
//    public List<WorkDays> getWorkDaysByMonth(Date startDate, Date endDate){
//        String sql = "from WorkDays where startDate > ? and ";
//        this.getHibernateTemplate()
//    }
//    
//    @Override
//    public List<WorkDays> getAll() {
//        return null;
//    }
//
//    @Override
//    public WorkDays get(Integer id) {
//        return null;
//    }
//
//    @Override
//    public boolean exists(Integer id) {
//        return false;
//    }
//
//
//
//    @Override
//    public void remove(Integer id) {
//
//    }
//
//    @Override
//    public List<WorkDays> getAllDistinct() {
//        return null;
//    }
//
//    @Override
//    public List<WorkDays> findByNamedQuery(String queryName, Map<String, Object> queryParams) {
//        return null;
//    }

}
